dynamic class com.c3d.mediaRotator.display.View extends MovieClip
{
    var _controller;
    var _loaderScreenTween;
    var _loadingScreenClip;
    var _mainViewMask;
    var _modalDimSlate;
    var _modalDimSlateDialogue;
    var _modalDimSlateDialogueText;
    var _modalDimSlateDialogueTextFormat;
    var _tabbedOverlaySubview;
    var _transitionCountdownPosition;
    var _transitionCountdownSubview;
    var _viewMovieClip;
    var _viewParent;
    var _viewReadyInterval;
    var endFill;

    function View($viewController, $viewParentMovieClip)
    {
        super();
        this._viewParent = $viewParentMovieClip;
        this.attachEventListeners();
        com.c3d.common.events.CentralDispatch.dispatchEvent({type: com.c3d.common.events.MVCEvent.VIEW_INSTANTIATED, target: this});
        this._controller = $viewController;
    }

    function attachEventListeners()
    {
        com.c3d.common.events.CentralDispatch.addEventListener(com.c3d.common.events.MVCEvent.MODEL_READY, mx.utils.Delegate.create(this, this.onMainModelReady));
    }

    function attachView($parentMovieClip)
    {
        this.attachLoaderScreen();
        this._viewMovieClip = $parentMovieClip.attachMovie("view_mc", "_viewMovieClip", $parentMovieClip.getNextHighestDepth());
        this._viewMovieClip.swapDepths(this._loadingScreenClip);
        this._viewMovieClip._visible = false;
        this._viewReadyInterval = setInterval(mx.utils.Delegate.create(this, this.checkViewMCInitStatus), 50);
    }

    function attachLoaderScreen()
    {
        this._loadingScreenClip = this._viewParent.attachMovie("loadingScreen", "loadingScreen_mc", this._viewParent.getNextHighestDepth());
    }

    function detachLoaderScreen()
    {
        this.fadeOutLoaderScreen();
    }

    function fadeOutLoaderScreen()
    {
        this._loaderScreenTween = new mx.transitions.Tween(this._loadingScreenClip, "_alpha", mx.transitions.easing.Strong.easeOut, this._loadingScreenClip._alpha, 0, 1, true);
        this._loaderScreenTween.onMotionFinished = mx.utils.Delegate.create(this, this.onFadeOutLoaderScreenComplete);
    }

    function onFadeOutLoaderScreenComplete($event)
    {
        this.removeLoaderScreen();
    }

    function removeLoaderScreen()
    {
        this._loadingScreenClip.removeMovieClip();
    }

    function createMainViewMask($maskTarget)
    {
        var __reg5 = this._controller.__get__bannerGlobalConfigParams().stageSize.x;
        var __reg4 = this._controller.__get__bannerGlobalConfigParams().stageSize.y;
        var __reg3 = this._controller.__get__bannerGlobalConfigParams().stageMarginSize.y;
        var __reg2 = this._controller.__get__bannerGlobalConfigParams().stageMarginSize.x;
        this._mainViewMask = $maskTarget.createEmptyMovieClip("viewMask_mc", $maskTarget.getNextHighestDepth());
        this._mainViewMask.beginFill(16763904, 0);
        this._mainViewMask.moveTo(__reg2 / 2, __reg3 / 2);
        this._mainViewMask.lineTo(__reg5 - __reg2 / 2, __reg3 / 2);
        this._mainViewMask.lineTo(__reg5 - __reg2 / 2, __reg4 - __reg3 / 2);
        this._mainViewMask.lineTo(__reg2 / 2, __reg4 - __reg3 / 2);
        this._mainViewMask.lineTo(__reg2 / 2, __reg3 / 2);
        this.endFill();
        return this._mainViewMask;
    }

    function checkViewMCInitStatus()
    {
        if (this._viewMovieClip.isReady) 
        {
            clearInterval(this._viewReadyInterval);
            this.on_internal_viewReady();
            return;
        }
    }

    function attachTabbedUI($parentMovieClip)
    {
        com.c3d.common.events.CentralDispatch.addEventListener("tabbedOverlayAttached", mx.utils.Delegate.create(this, this.onTabbedOverlayAttached));
        var __reg2 = $parentMovieClip.attachMovie("tabbedOverlay_mc", "_tabbedOverlay", $parentMovieClip.getNextHighestDepth());
        __reg2.swapDepths(this._loadingScreenClip);
        return __reg2;
    }

    function attachTransitionCountdown($parentMovieClip)
    {
        var __reg2 = this._controller.__get__bannerGlobalConfigParams();
        this._transitionCountdownPosition = __reg2.transitionCountdownPos;
        com.c3d.common.events.CentralDispatch.addEventListener("transitionCountdownAttached", mx.utils.Delegate.create(this, this.onTransitionCountdownAttached));
        var __reg3 = $parentMovieClip.attachMovie("transitionCountdown_mc", "_transitionCountdown", $parentMovieClip.getNextHighestDepth());
        __reg3.swapDepths(this._loadingScreenClip);
        return __reg3;
    }

    function onTabbedOverlayAttached()
    {
    }

    function onTransitionCountdownAttached()
    {
    }

    function on_internal_viewReady()
    {
        this._tabbedOverlaySubview = this.attachTabbedUI(this._viewParent);
        this._transitionCountdownSubview = this.attachTransitionCountdown(this._viewParent);
        this._transitionCountdownSubview._x = this._transitionCountdownPosition.x;
        this._transitionCountdownSubview._y = this._transitionCountdownPosition.y;
        this._transitionCountdownSubview.bind(this._controller);
        this._tabbedOverlaySubview.initialize(this._controller);
        this._viewMovieClip.setMask(this.createMainViewMask(this._viewParent));
        com.c3d.common.events.CentralDispatch.dispatchEvent({type: com.c3d.common.events.MVCEvent.VIEW_READY, target: this});
    }

    function render()
    {
        this.attachView(this._viewParent);
    }

    function get viewMovieClip()
    {
        return this._viewMovieClip;
    }

    function requestModalDimStart()
    {
        var __reg4 = this._controller.__get__bannerGlobalConfigParams().stageSize.y;
        var __reg2 = this._controller.__get__bannerGlobalConfigParams().stageSize.x;
        var __reg3 = 40;
        this._modalDimSlate = this._viewParent.createEmptyMovieClip("modalDimSlate", this._viewParent.getNextHighestDepth());
        this._modalDimSlate.beginFill(3355443, 60);
        this._modalDimSlate.moveTo(0, 0);
        this._modalDimSlate.lineTo(__reg2, 0);
        this._modalDimSlate.lineTo(__reg2, __reg4);
        this._modalDimSlate.lineTo(0, __reg4);
        this._modalDimSlate.lineTo(0, 0);
        this._modalDimSlate.endFill();
        this._modalDimSlateDialogue = this._modalDimSlate.createEmptyMovieClip("modalDimSlateDialogue_mc", this._modalDimSlate.getNextHighestDepth());
        this._modalDimSlateDialogueText = this._modalDimSlateDialogue.createTextField("modalDimSlateDialogueText_mc", this._modalDimSlateDialogue.getNextHighestDepth(), 0, 0, 10, 10);
        this._modalDimSlateDialogueText.embedFonts = true;
        this._modalDimSlateDialogueText.autoSize = "right";
        this._modalDimSlateDialogueText.selectable = false;
        this._modalDimSlateDialogueText.text = "CLOSE  X";
        this._modalDimSlateDialogueTextFormat = new TextFormat();
        this._modalDimSlateDialogueTextFormat.color = 16777215;
        this._modalDimSlateDialogueTextFormat.size = 16;
        this._modalDimSlateDialogueTextFormat.align = "right";
        this._modalDimSlateDialogueTextFormat.font = "Slideshow_type";
        this._modalDimSlateDialogueText.setTextFormat(this._modalDimSlateDialogueTextFormat);
        this._modalDimSlateDialogueText._x = __reg2 - this._modalDimSlateDialogueText.textWidth - __reg3;
        this._modalDimSlateDialogueText._y = __reg3;
        this._modalDimSlate.onRelease = mx.utils.Delegate.create(this, this.onModalDimButtonPress);
    }

    function requestModalDimEnd()
    {
        delete this._modalDimSlate.onRelease;
        this._modalDimSlate.removeMovieClip();
    }

    function onModalDimButtonPress()
    {
        this.requestModalDimEnd();
        com.c3d.common.events.CentralDispatch.dispatchEvent({type: "modalDimButtonPress", target: this});
    }

    function onMainModelReady()
    {
        this._viewMovieClip.setMask(this.createMainViewMask(this._viewParent));
    }

    function requestHideLoaderScreen()
    {
        this.detachLoaderScreen();
    }

    function get viewRoot()
    {
        return this._viewParent;
    }

    function set controller($c)
    {
        this._controller = $c;
    }

}
